VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "msmask32.ocx"
Begin VB.Form frmAgregarEmpleado 
   BackColor       =   &H00004040&
   ClientHeight    =   3240
   ClientLeft      =   60
   ClientTop       =   60
   ClientWidth     =   4395
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   Moveable        =   0   'False
   ScaleHeight     =   3240
   ScaleWidth      =   4395
   StartUpPosition =   2  'CenterScreen
   Begin MSDataListLib.DataCombo cboEmpleados 
      Bindings        =   "frmAgregarEmpleado.frx":0000
      Height          =   315
      Left            =   240
      TabIndex        =   9
      Top             =   840
      Width           =   3735
      _ExtentX        =   6588
      _ExtentY        =   556
      _Version        =   393216
      ListField       =   "nombres"
      BoundColumn     =   "codigo_empleado"
      Text            =   ""
      Object.DataMember      =   "LosActivos"
   End
   Begin VB.CommandButton CmdSalir 
      BackColor       =   &H0080C0FF&
      Caption         =   "Salir"
      Height          =   375
      Left            =   2280
      MouseIcon       =   "frmAgregarEmpleado.frx":0011
      MousePointer    =   99  'Custom
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   2520
      Width           =   1695
   End
   Begin MSMask.MaskEdBox mskSueldo 
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   1680
      Width           =   1815
      _ExtentX        =   3201
      _ExtentY        =   661
      _Version        =   393216
      Appearance      =   0
      MaxLength       =   14
      Mask            =   "#-#-#-##-##-##"
      PromptChar      =   "_"
   End
   Begin MSMask.MaskEdBox mskVacacion 
      Height          =   375
      Left            =   2280
      TabIndex        =   1
      Top             =   1680
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   661
      _Version        =   393216
      Appearance      =   0
      MaxLength       =   14
      Mask            =   "#-#-#-##-##-##"
      PromptChar      =   "_"
   End
   Begin MSMask.MaskEdBox mskHorasExtras 
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   2520
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   661
      _Version        =   393216
      Appearance      =   0
      MaxLength       =   14
      Mask            =   "#-#-#-##-##-##"
      PromptChar      =   "_"
   End
   Begin VB.Label Label2 
      BackColor       =   &H00004040&
      Caption         =   "Nombre del Empleado"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   240
      TabIndex        =   8
      Top             =   600
      Width           =   2055
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000005&
      X1              =   120
      X2              =   4200
      Y1              =   360
      Y2              =   360
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Agregar Empleado"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   375
      Left            =   120
      TabIndex        =   7
      Top             =   0
      Width           =   2415
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "Vacaciones"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   2280
      TabIndex        =   6
      Top             =   1440
      Width           =   1215
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "Sueldo"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   240
      TabIndex        =   5
      Top             =   1440
      Width           =   1215
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "Horas Extras"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   240
      TabIndex        =   4
      Top             =   2280
      Width           =   1215
   End
End
Attribute VB_Name = "frmAgregarEmpleado"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cboEmpleados_KeyDown(KeyCode As Integer, Shift As Integer)
HacerTab KeyCode
End Sub

Private Sub CmdSalir_Click()
    On Error GoTo Errores
    Set rscuenta = New ADODB.Recordset

        Dim Confirmar As Integer
        Confirmar = MsgBox("Desea Guardar los datos?", vbYesNo + vbQuestion + vbDefaultButton2)
        If Confirmar = vbYes Then
             'Verificar que las cuenta existan

         If DE.rsplaPKEmpleados.State = adStateOpen Then DE.rsplaPKEmpleados.Close
            DE.plaPKEmpleados Trim(Me.cboEmpleados.BoundText)
        
            With DE.rsplaPKEmpleados
                If Not .EOF Then
                    tipoplanilla = .Fields("iCodigo_TipoPlanilla")
               End If
            End With
              
            If tipoplanilla = 2 Or tipoplanilla = 4 Or tipoplanilla = 17 Or tipoplanilla = 8 Or tipoplanilla = 10 Or _
                tipoplanilla = 11 Or tipoplanilla = 9 Or tipoplanilla = 3 Or tipoplanilla = 5 Or _
                tipoplanilla = 12 Or tipoplanilla = 20 Or tipoplanilla = 19 Then
                Empresa = 1
            End If
            
              
            If tipoplanilla = 6 Or tipoplanilla = 22 Or tipoplanilla = 23 Or tipoplanilla = 24 Or tipoplanilla = 25 Then
                    Empresa = 4
            End If
            
            'verifico que Exista la cuenta para las  Hora extras
            If Me.mskHorasExtras.Text <> "_-_-_-__-__-__" Then
                   rscuenta.Open "Select * from SACF_contpresupuesto..cypCatalogoCuenta where (tNumEmpresa=" & Empresa & ") and (cNumCuenta='" & Me.mskHorasExtras.Text & "')", DE.Cnn, adOpenDynamic, adLockReadOnly
                   If rscuenta.RecordCount <> 0 Then
                      existecuenta = True
                   Else
                      existecuenta = False
                   End If
                   
                   If existecuenta = False Then
                    MsgBox "Este Numero de cuenta para las horas extras no existe"
                    Exit Sub
                   End If
                   rscuenta.Close
            End If
            
            
            'verifico que Exista la cuenta para el sueldo
            If Me.mskSueldo.Text <> "_-_-_-__-__-__" Then
                   rscuenta.Open "Select * from SACF_contpresupuesto..cypCatalogoCuenta where (tNumEmpresa=" & Empresa & ") and (cNumCuenta='" & Me.mskSueldo.Text & "')", DE.Cnn, adOpenDynamic, adLockReadOnly
                   If rscuenta.RecordCount <> 0 Then
                      existecuenta = True
                   Else
                      existecuenta = False
                   End If
                   
                   If existecuenta = False Then
                    MsgBox "Este Numero de cuenta para el sueldo no existe"
                    Exit Sub
                   End If
                   rscuenta.Close
            End If

            
           
            
            'verifico que Exista la cuenta para la vacacio
            If Me.mskVacacion.Text <> "_-_-_-__-__-__" Then
                   rscuenta.Open "Select * from SACF_contpresupuesto..cypCatalogoCuenta where (tNumEmpresa=" & Empresa & ") and (cNumCuenta='" & Me.mskVacacion.Text & "')", DE.Cnn, adOpenDynamic, adLockReadOnly
                   If rscuenta.RecordCount <> 0 Then
                      existecuenta = True
                   Else
                      existecuenta = False
                   End If
                   
                   If existecuenta = False Then
                    MsgBox "Este Numero de cuenta para la vacacion  no existe"
                    Exit Sub
                   End If
                   rscuenta.Close
            End If

          
        
            DE.MCuentasContablesEmpleados Accion, cboEmpleados.BoundText, Me.mskSueldo.Text, Me.mskVacacion.Text, Me.mskHorasExtras

            
        End If
        Unload Me
   

Exit Sub
Errores:
    
    MsgBox "Esta asignacion ya se realizo"
End Sub

Private Sub mskHorasExtras_KeyDown(KeyCode As Integer, Shift As Integer)
HacerTab KeyCode
End Sub

Private Sub mskSueldo_KeyDown(KeyCode As Integer, Shift As Integer)
HacerTab KeyCode
End Sub

Private Sub mskVacacion_KeyDown(KeyCode As Integer, Shift As Integer)
HacerTab KeyCode
End Sub
